﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MarryShowEdit.aspx.cs" Inherits="Com.CMS263.Web.manage.MarryInfo.MarryShowEdit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
         <link href="../style/main.css" rel="stylesheet" type="text/css" />
    <link href="../common/validator.css" rel="stylesheet" type="text/css" />

    <script src="../../js/Calendar1.js" type="text/javascript"></script>
    <script src="/js/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="/js/common.js" type="text/javascript"></script>
    <style type="text/css">
        .style1
        {
        	text-align:center;
        }
        .style2
        {
            text-align: right;
        }
    </style>
    <style type="text/css">
    .preview_fake{
             filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);     
    }     
         #SortId
         {
             width: 150px;
         }
     </style>
     <script language="javascript" type="text/javascript">
         $(function() {
             $("#updateImage").hide();
         })
         $(document).ready(function() {
         $("#tvName option").each(function() {

         if ($(this).attr("value") == '<%=marry.TvId %>') {
                     $(this).attr("selected", "selected");
                 }

             })
         })
         function save() {
             if ($("#title").val().length < 1) {
                 alert("标题必填！");
                 $("#title").focus();
                 return false;
             } else if ($("#man").val().length < 1) {
                 alert("男方姓名必填！");
                 $("#man").focus();
                 return false;
             } else if ($("#woman").val().length < 1) {
                 alert("女方姓名必填！");
                 $("#woman").focus();
                 return false;
             } else if ($("#info").val().length < 1) {
                 alert("介绍必填！");
                 $("#info").focus();
                 return false;
             } else if ($("#description").val().length < 1) {
                 alert("感言必填！");
                 $("#description").focus();
                 return false;
             } else if ($("#showTime").val().length < 1) {
                 alert("播出时间必填！");
                 return false;
             } else if ($("#tvName").val() == "0") {
                 alert("播出电视台必选！");
                 $("#tvName").focus();
                 return false;
             } else {
                 return true;
             }
         }
         function onUploadImgChange(sender, width, height, index) {
             $("#updateImage").show();
             $("#headPic").val($(sender).val());
             try {
                 index = index == undefined ? "" : index;
                 if (!sender.value.match(/.jpg|.gif|.png|.bmp/i)) {
                     alert('请上传.jpg|.gif|.png|.bmp类型的图片');
                     return false;
                 }

                 var objPreview = $(".preview_pic" + index);
                 var objPreviewFake = document.getElementById('preview_fake' + index);

                 if (sender.files && sender.files[0]) {
                     objPreview.show();
                     objPreview.attr("width", width);
                     objPreview.attr("height", height);

                     objPreview.attr("src", sender.files[0].getAsDataURL());



                 } else if (objPreviewFake.filters) {
                     sender.select();
                     var imgSrc = document.selection.createRange().text;
                     objPreviewFake.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = imgSrc;

                     objPreviewFake.style.width = width + 'px';
                     objPreviewFake.style.height = height + 'px';
                     objPreview.hide();
                     sender.blur();
                 }
             } catch (ex) {
                 alert(ex);
                 alert("图片加载失败！");
             }
         }
         function checkNum(obj) {
             var tempstr;
             //先把非数字的都替换掉，除了数字和.   
             tempstr = obj.value.replace(/[^\d]/g, "");
             obj.value = tempstr;
         }
    </script>
</head>
<body>
    <form id="form1" runat="server"  enctype="multipart/form-data">
    <div>
    <input  type="hidden" value="<%=marry.Id %>" name="Id" id="Id"/>
   <input  type="hidden" value="<%=page%>" name="Id" id="page"/>
        <table style="width:98%;" class="table_1">
            <tr class="table_2">
                <td class="style1" colspan="3">
                    添加上电视啦</td>
            </tr>
            <tr>
                <td class="style2">
                    标题:</td>
                <td>
                    <input ID="title" name="title" value="<%=marry.Title %>" Width="164px"/>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style2">
                    男方姓名:</td>
                <td>                   
                    <input  id="man" name="man" value="<%=marry.Man %>" Width="164px"/>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style2">
                    女方姓名:</td>
                <td>
                <input  id="woman" name="woman" value="<%=marry.Woman %>" Width="164px"/>           
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style2">
                    介绍:</td>
                <td>               
                 <textarea  name="info" id="info"  cols='45' rows='5'><%=marry.Info %> </textarea>                 
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style2">
                    感言:</td>
                <td>
                  <textarea  name="description" id="description"  cols='45' rows='7'><%=marry.Description%> </textarea>       
                 
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style2">
                    播出时间:</td>
                <td> 
                <input onfocus="calendar()" name="showTime" id="showTime" value="<%=marry.ShowTime%>" type="text"/>
                  </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style2">
                    播出电视台:</td>
                <td>
                 <select name="tvName" id="tvName">
                 <option value="0">请选择...</option>
                 <%foreach (Com.CMS263.PO.TVstation item in tvlist){
                      %>                      
                      <option value="<%=item.Id %>"><%=item.Name %></option><%}%>                
                 </select>                    
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style2">
                    原始照片</td>
                <td class="tdside">                
              <img id="changeImg"  src="/ArtUpFile/<%=marry.FilePath%>" width="100px" height="100px"/>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    修改照片:
                </td>
                <td >                 
                <input type='file' name="FilePath" id="FilePath" value="<%=marry.FilePath %>"  onchange="onUploadImgChange(this,100,100);"/>
                  <div id="updateImage">
      <div id="preview_fake" class="preview_fake">      
      <img  alt="" class="preview_pic" src=""   width="100px" height="100px"/>      
      </div> 
      </div>         
                &nbsp;</td>
            </tr>
                <tr>
                <td class="style2">
                    排序:
                </td>
                <td >
                 <input type="text" name="orderNum" id="orderNum"  value="<%=marry.OrderNum %>" onkeyup="checkNum(this);" onblur="checkNum(this);"  />
                &nbsp;</td>
            </tr>
            <tr>
                <td  style=" text-align:center" colspan="3">
                    <asp:Button ID="Button1" runat="server" Text="更新" onclick="Button1_Click" OnClientClick="return save();" />
                    <input type="reset" value="重置" />
                    <input type="button" value="返回" onclick="javascript:history.go(-1)" />
                </td>
            </tr>
        </table>
    
    </div>
    </form>
</body>
</html>
